﻿using System;
using UnityEngine;

public class FollowMousePlaneXZ : MonoBehaviour
{
    private Camera mainCam;
    private Transform tsm;
    public float y;

    private void Awake()
    {
        this.tsm = base.transform;
    }

    private void LateUpdate()
    {
        if (this.mainCam == null)
        {
            this.mainCam = Camera.main;
        }
        if (this.mainCam != null)
        {
            this.tsm.position = this.mainCam.GetWorldPositionOnPlaneXZ(Input.mousePosition, this.y);
        }
    }
}

